home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * @(#) mystreams.c 12.1 95/07/05 SCOINC
- */
- /***************************************************************************
- *
- * Copyright (c) 1990-1993 The Santa Cruz Operation, Inc.
- *
- * All rights reserved. No part of this program or publication may be
- * reproduced, transmitted, transcribed, stored in a retrieval system,
- * or translated into any language or computer language, in any form or
- * by any means, electronic, mechanical, magnetic, optical, chemical,
- * biological, or otherwise, without the prior written permission of:
- *
- * The Santa Cruz Operation , Inc. (408) 425-7222
- * 400 Encinal St., Santa Cruz, California 95060 USA
- *
- **************************************************************************/
- /*
- * Modification History
- *
- * S004, 25-Oct-93, rickra
- * Added 32v5 streams stuff.
- *
- * S003, 25-Oct-93, rickra
- * Multiplied nqueue info by 2 since in the kernel, queues are allocated
- * in pairs....
- *
- * S002, 27-May-93, rickra
- * Added support for pixmap.
- *
- * S001, 01-Jan-93, rickra
- * Added support for seperate windows.
- * Made code for stremas blocks a function, to reduce code...
- *
- * S000, 30-Sep-92, rickra
- * Added copyright and modification history
- */
- /*+-------------------------------------------------------------------------
- streams.c - XSW streams display handler
-
- Defined functions:
- draw_streams_literals(x,y)
- update_streams()
-
- --------------------------------------------------------------------------*/
- /*+:EDITS:*/
- #include <X11/Xlib.h>
- #include <X11/Xutil.h>
- #include <X11/Intrinsic.h>
- #include <X11/Shell.h>
- #include <Xm/Xm.h>
- #include <Xm/MainW.h>
- #include <Xm/DrawingA.h>
-
- #include "include/unixincs.h"
- #include "include/buttons.h"
- #include "include/xsw.h"
-
- extern struct NetworkXswStruct *current_server;
-
-
- extern int must_be_32v5;
-
- int streams_tlx;
- int streams_tly;
-
-
-
- typedef struct mystreamlist
- {
- char *stream_name;
- } streams_list;
-
- int stream_buf_start = 4; /* Set to first stream buffer in name
- * list */
- static streams_list mystream_list[] =
- {
- {"NSTREAM "},
- {"NQUEUE "},
- {"MBLOCK "},
- {"DBLOCK "},
- {"NBLK4 "},
- {"NBLK16 "},
- {"NBLK64 "},
- {"NBLK128 "},
- {"NBLK256 "},
- {"NBLK512 "},
- {"NBLK1024 "},
- {"NBLK2048 "},
- {"NBLK4096 "}
- };
-
- int stream_buf_start32v5 = 3;
-
- static streams_list mystream_list32v5[] =
- {
- {"NSTREAM "},
- {"NQUEUE "},
- {"MBLOCK "},
- {"BUFFFER HEADERS "},
- {"NBLK16 "},
- {"NBLK128 "},
- {"NBLK256 "},
- {"NBLK512 "},
- {"NBLK1K "},
- {"NBLK2K "},
- {"NBLK4K "},
- {"NBLK8K "},
- {"NBLK16K "},
- {"NBLK32K "},
- {"NBLK64K "},
- {"NBLK128K "},
- {"NBLK256K "},
- {"NBLK512K "}
- };
- void
- update_streams_buffers (window, display, gc, DrawAreaXYWH, pixmap, x, y, i)
- Window window;
- Display *display;
- GC gc;
- XWindowAttributes DrawAreaXYWH;
- Pixmap pixmap;
-
-
- int x;
- int y;
- int i;
-
- {
- int configured = 0;
- int temp_int;
- unsigned long pixel;
-
- struct mystreamlist *stream_list;
-
- int buf_start = 4;
-
-
- if ( current_server -> os_version == 0 )
- {
-
- stream_list = *(&mystream_list);
- buf_start = stream_buf_start;
-
- switch (i)
- {
-
- case 0:
- configured = current_server -> my_v -> v_nblk4;
- break;
- case 1:
- configured = current_server -> my_v -> v_nblk16;
- break;
- case 2:
- configured = current_server -> my_v -> v_nblk64;
- break;
- case 3:
- configured = current_server -> my_v -> v_nblk128;
- break;
- case 4:
- configured = current_server -> my_v -> v_nblk256;
- break;
- case 5:
- configured = current_server -> my_v -> v_nblk512;
- break;
- case 6:
- configured = current_server -> my_v -> v_nblk1024;
- break;
- case 7:
- configured = current_server -> my_v -> v_nblk2048;
- break;
- case 8:
- configured = current_server -> my_v -> v_nblk4096;
- break;
-
- }
- }
- else
- if ( current_server -> os_version == 1 )
- {
-
- stream_list = *(&mystream_list32v5);
-
- buf_start = stream_buf_start32v5;
-
- configured = current_server -> pagest->alc[i];
-
- }
-
-
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, stream_list[i + buf_start].stream_name);
- x += (FWIDTH * 16);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", colorStaticNumeric.pixel, configured);
- x += (FWIDTH * 8);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", colorNumeric.pixel, current_server -> mystreams -> dblk[i].use);
- x += (FWIDTH * 7);
- temp_int = (int) ((
- (float) ((float) current_server -> mystreams -> dblk[i].use / (float) configured)) * 100);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", colorNumeric.pixel, temp_int);
- x += (FWIDTH * 7);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%10ld", colorNumeric.pixel, current_server -> mystreams -> dblk[i].total);
- x += (FWIDTH * 10);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", colorNumeric.pixel, current_server -> mystreams -> dblk[i].max);
- x += (FWIDTH * 7);
-
- if (current_server -> mystreams -> dblk[i].fail > 0)
- pixel = colorNumericAlarm.pixel;
- else
- pixel = colorNumeric.pixel;
-
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", pixel, current_server -> mystreams -> dblk[i].fail);
-
- }
-
- /*+-------------------------------------------------------------------------
- update_streams()
- --------------------------------------------------------------------------*/
- void
- update_streams (SP)
- struct NetworkXswStruct *SP;
-
- {
- Window window = SP -> SEPERATE_WINDOWS_LIST[BUTTON_streams].window;
- Display *display = SP -> SEPERATE_WINDOWS_LIST[BUTTON_streams].display;
- GC gc = SP -> SEPERATE_WINDOWS_LIST[BUTTON_streams].gc;
- XWindowAttributes DrawAreaXYWH = SP -> SEPERATE_WINDOWS_LIST[BUTTON_streams].DrawAreaXYWH;
- Pixmap pixmap = SP -> SEPERATE_WINDOWS_LIST[BUTTON_streams].pixmap;
-
- register int x = 0;
- register int y = FHEIGHT;
- int fheight = FHEIGHT;
- unsigned long pixel;
-
- int temp_int;
-
- int dblk_tot_config;
- int i;
-
- int nclass;
-
- /*
- y = streams_tly + fheight;
- x = streams_tlx;
- */
-
- #ifdef XSW32v5
- #ifdef STILLWORKINGHERE
- if (must_be_32v5)
-
- {
-
- for (i = 0; i < 15; i++)
- {
- x = streams_tlx;
-
- disp_text (window, display, gc, DrawAreaXYWH, pixmap,
- x, y, colorLabel.pixel,
- mystream_list32v5[i].stream_name);
- x += (FWIDTH * 23);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", colorNumeric.pixel, current_server -> mystreams32v5 -> alc[i]);
-
- y += fheight;
- }
-
- }
- else
- #endif
- #endif
- {
-
- /* NSTREAM */
- /*
- x = streams_tlx;
- */
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "NSTREAM ");
- x += (FWIDTH * 16);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", colorStaticNumeric.pixel, current_server -> my_v -> v_nstream);
- x += (FWIDTH * 8);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", colorNumeric.pixel, current_server -> mystreams -> stream.use);
- x += (FWIDTH * 7);
- temp_int = (int) (((float) current_server -> mystreams -> stream.use / current_server -> my_v -> v_nstream) * 100);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", colorNumeric.pixel, temp_int);
- x += (FWIDTH * 7);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%10ld", colorNumeric.pixel, current_server -> mystreams -> stream.total);
- x += (FWIDTH * 10);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", colorNumeric.pixel, current_server -> mystreams -> stream.max);
- x += (FWIDTH * 7);
-
- if (current_server -> mystreams -> stream.fail > 0)
- pixel = colorNumericAlarm.pixel;
- else
- pixel = colorNumeric.pixel;
-
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", pixel, current_server -> mystreams -> stream.fail);
- /* NQUEUE */
- y += fheight;
- x = streams_tlx;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "NQUEUE ");
- x += (FWIDTH * 16);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", colorStaticNumeric.pixel, current_server -> my_v -> v_nqueue);
- x += (FWIDTH * 8);
-
- /*
- fprintf (stdout, "queue.use = %d \n", current_server -> mystreams -> queue.use);
- */
-
- current_server -> mystreams -> queue.use =
- current_server -> mystreams -> queue.use * 2;
-
- current_server -> mystreams -> queue.max =
- current_server -> mystreams -> queue.max * 2;
-
-
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", colorNumeric.pixel, current_server -> mystreams -> queue.use);
- x += (FWIDTH * 7);
- temp_int = (int) (((float) current_server -> mystreams -> queue.use / current_server -> my_v -> v_nqueue) * 100);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", colorNumeric.pixel, temp_int);
- x += (FWIDTH * 7);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%10ld", colorNumeric.pixel, current_server -> mystreams -> queue.total);
- x += (FWIDTH * 10);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", colorNumeric.pixel, current_server -> mystreams -> queue.max);
- x += (FWIDTH * 7);
-
- if (current_server -> mystreams -> queue.fail > 0)
- pixel = colorNumericAlarm.pixel;
- else
- pixel = colorNumeric.pixel;
-
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", pixel, current_server -> mystreams -> queue.fail);
-
-
- /* MBLOCK */
- x = streams_tlx;
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "MBLOCK ");
- x += (FWIDTH * 16);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", colorStaticNumeric.pixel, *current_server -> mynmblock);
- x += (FWIDTH * 8);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", colorNumeric.pixel, current_server -> mystreams -> mblock.use);
- x += (FWIDTH * 7);
- temp_int = (int) ((
- (float) ((float) current_server -> mystreams -> mblock.use / *current_server -> mynmblock)) * 100);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", colorNumeric.pixel, temp_int);
- x += (FWIDTH * 7);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%10ld", colorNumeric.pixel, current_server -> mystreams -> mblock.total);
- x += (FWIDTH * 10);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", colorNumeric.pixel, current_server -> mystreams -> mblock.max);
- x += (FWIDTH * 7);
-
- if (current_server -> mystreams -> mblock.fail > 0)
- pixel = colorNumericAlarm.pixel;
- else
- pixel = colorNumeric.pixel;
-
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", pixel, current_server -> mystreams -> mblock.fail);
-
-
- /* DBLOCK */
-
- if ( current_server -> os_version == 0 )
- {
- dblk_tot_config = current_server -> my_v -> v_nblk4 + current_server -> my_v -> v_nblk16 + current_server -> my_v -> v_nblk64 + current_server -> my_v -> v_nblk128 +
- current_server -> my_v -> v_nblk256 + current_server -> my_v -> v_nblk512 + current_server -> my_v -> v_nblk1024 +
- current_server -> my_v -> v_nblk2048 + current_server -> my_v -> v_nblk4096;
- x = streams_tlx;
- y += fheight;
- disp_text (window, display, gc, DrawAreaXYWH, pixmap, x, y, colorLabel.pixel, "DBLK TOT ");
- x += (FWIDTH * 16);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", colorStaticNumeric.pixel, dblk_tot_config);
- x += (FWIDTH * 8);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", colorNumeric.pixel, current_server -> mystreams -> dblock.use);
- x += (FWIDTH * 7);
- temp_int = (int) ((
- (float) ((float) current_server -> mystreams -> dblock.use / (float) dblk_tot_config)) * 100);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", colorNumeric.pixel, temp_int);
- x += (FWIDTH * 7);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%10ld", colorNumeric.pixel, current_server -> mystreams -> dblock.total);
- x += (FWIDTH * 10);
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", colorNumeric.pixel, current_server -> mystreams -> dblock.max);
- x += (FWIDTH * 7);
-
- if (current_server -> mystreams -> dblock.fail > 0)
- pixel = colorNumericAlarm.pixel;
- else
- pixel = colorNumeric.pixel;
-
- disp_long (window, display, gc, DrawAreaXYWH, pixmap, x, y, "%7ld", pixel, current_server -> mystreams -> dblock.fail);
-
- }
-
-
- if ( current_server -> os_version == 0 )
- nclass = 9;
- else
- if ( current_server -> os_version == 1 )
- nclass = 15;
-
- for (i = 0; i < nclass; i++)
- {
- x = streams_tlx;
- y += fheight;
- update_streams_buffers (window, display, gc, DrawAreaXYWH, pixmap, x, y, i);
-
- }
-
- }
-
-
- } /* end of update_streams */
-
- /*+-------------------------------------------------------------------------
- draw_streams_literals(x,y)
- --------------------------------------------------------------------------*/
- void
- draw_streams_literals (SP)
- struct NetworkXswStruct *SP;
- {
- Window window = SP -> SEPERATE_WINDOWS_LIST[BUTTON_streams].window;
- Display *display = SP -> SEPERATE_WINDOWS_LIST[BUTTON_streams].display;
- GC gc = SP -> SEPERATE_WINDOWS_LIST[BUTTON_streams].gc;
- XWindowAttributes DrawAreaXYWH = SP -> SEPERATE_WINDOWS_LIST[BUTTON_streams].DrawAreaXYWH;
- Pixmap pixmap = SP -> SEPERATE_WINDOWS_LIST[BUTTON_streams].pixmap;
-
- int x = 0;
- int y = 0;
-
-
- int x2 = x;
- int ys = y + FASCENT;
- int yl1 = y + (FASCENT / 2) + 1;
- int yl2 = y + (FHEIGHT / 2);
- int len;
- char *cptr;
- int fheight = FHEIGHT;
- int fwidth = FWIDTH;
- int line_style = LineSolid;
- int cap_style = CapButt;
- int join_style = JoinMiter;
-
- streams_tlx = x;
- streams_tly = y;
-
- /* the "background" color */
- XSetForeground (display, gc, colorTitleBarBG.pixel);
- XSetLineAttributes (display, gc, fheight,
- line_style, cap_style, join_style);
- /*
- XDrawLine (display, window, gc, x, yl2, DrawAreaXYWH.width - BORDER_EXTRA_WIDTH , yl2);
- */
- XDrawLine (display, pixmap, gc, x, yl2, SP -> SEPERATE_WINDOWS_LIST[BUTTON_streams].width - BORDER_EXTRA_WIDTH, yl2);
-
- /* "-Streams Config Use %Use ... -" */
- XSetForeground (display, gc, colorTitleBarFG.pixel);
- XSetLineAttributes (display, gc, FASCENT / 2,
- line_style, cap_style, join_style);
- /*
- XDrawLine (display, window, gc,
- x2, yl1,
- x2 + (len = (fwidth * 5)) - FGAP, yl1);
- */
- XDrawLine (display, pixmap, gc,
- x2, yl1,
- x2 + (len = (fwidth * 5)) - FGAP, yl1);
- x2 += len;
-
- if (must_be_32v5)
- cptr = "Streams Count Pages Total Max Fail";
- else
- cptr = "Streams Config Use %Use Total Max Fail";
-
- /*
- XDrawString (display, window, gc, x2, ys, cptr, len = strlen (cptr));
- XDrawString (display, window, gc, x2 + 1, ys, cptr, len);
- */
- XDrawString (display, pixmap, gc, x2, ys, cptr, len = strlen (cptr));
- XDrawString (display, pixmap, gc, x2 + 1, ys, cptr, len);
- x2 += (fwidth * len) + FGAP + 1;
- /*
- XDrawLine (display, window, gc, x2, yl1, DrawAreaXYWH.width - BORDER_EXTRA_WIDTH , yl1);
- */
- XDrawLine (display, window, gc, x2, yl1, SP -> SEPERATE_WINDOWS_LIST[BUTTON_streams].width - BORDER_EXTRA_WIDTH, yl1);
-
- } /* end of draw_streams_literals */
-
- /* vi: set tabstop=4 shiftwidth=4: */
- /* end of sysinfo.c */
-